<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<x:parse xml="${param.xmlstr}" var="xmlData" />






<table id="tblDetailed" cellpadding="0" class="t_css" width="100%"
	border="0" cellpadding="0" style="*border-bottom: #a1c0dc 1px solid; table-layout: fixed;" >
	<col width="4%"/>
	<col width="6%"/>
	<col width="10%"/>
	<col width="14%"/>
	<col width="10%"/>
	<col width="13%"/>
	<col width="13%"/>
	<col width="10%"/>
	<col width="10%"/>
	<col width="10%"/>
	<thead >
					<tr style="border:1px solid #B7D1E6">
						<th class="TblHead" align="center" >选择</th>
						<th class="TblHead" align="center" >序号</th>
						<th class="TblHead" align="center" >贷款银行</th> 
						<th class="TblHead" align="center" >贷款类别</th> 
				      <th class="TblHead" align="center" >贷款金额</th> 
						<th class="TblHead" align="center" >贷款合同编号</th>
						<th class="TblHead" align="center" >贷款期限（月）</th>   
						<th class="TblHead" align="center" >贷款利率（%）</th>   
						<th class="TblHead" align="center" >利息总额</th> 
						<th class="TblHead" align="center" >已付利息</th>                    
					</tr>
			</thead>
			<tbody id="tab">
					<tr style="display:none" align="center">
						<td align="center">
							<input type="radio" class="radiobutton" name="selCredit" >
						</td>
						<td align="center">
							<span name="credit|list[0]@seq_no" >[index]</span> 
						</td>
						<td align="center">
							<input type="text" name="credit|list[0]|bank" label="贷款银行" class=" required input_text " maxlength="50" style="width:80%"/>
						</td>
						<td align="center">
							<cpt:select id="apurchase_auto[index]" key="credit"  name="purchase2" onChange="initControlValue(this.id);countjsTable9('tblDetailed');" style="width:80%"></cpt:select>
					                <input type="hidden" name="credit|list[0]|purchase2_value" class="required" label="贷款类别" />
					                <input type="hidden" name="credit|list[0]|purchase2_name" value=""/>
						</td> 
						<td align="center">
							<input type="text" name="credit|list[0]|money" onchange="countjsTable9('tblDetailed');"
								label="贷款金额" onfocus="InitInput.setNumber(this,9,2,2)"   style="text-align:right;width:80%" class=" input_text required" />
						</td> 
						
						<td align="center">
							<input type="text" name="credit|list[0]|contract" label="贷款合同编号" class=" input_text required" maxlength="50" style="width:80%"/>
						</td>
					
						<td align="center" nowrap>
							<input type="text" name="credit|list[0]|loan_term" label="贷款期限" onfocus="InitInput.setNumber(this,9,0,0)"   style="text-align:right;width:80%" class=" input_text required" />
                 				<td align="center">
							<input type="text" name="credit|list[0]|interest_rate" label="贷款利率（%）" onfocus="InitInput.setNumber(this,9,2,2)"   style="text-align:right;width:80%" class=" input_text required" />
						</td> 
						<td align="center">
							<input type="text" id="list[0]_interest_total" name="credit|list[0]|interest_total" onchange="countjsTable9('tblDetailed');"	label="利息总额" onfocus="InitInput.setNumber(this,9,2,2)"   style="text-align:right;width:80%" class=" input_text required valueGreatEqual:list[0]_interest_total:list[0]_interest_already" />
						</td> 
						<td align="center">
							<input type="text" id="list[0]_interest_already" name="credit|list[0]|interest_already" onchange="countjsTable9('tblDetailed');"	label="已付利息" onfocus="InitInput.setNumber(this,9,2,2)"   style="text-align:right;width:80%" class=" input_text required" />
						</td> 
						
					</tr>
					
					<c:set value="0" var="index" scope="page"/>
					<x:forEach select="$xmlData/data/credit/list" var="list">
					
					<c:choose>
						<c:when test="${index<10}" ><c:set value="0" var="flag" scope="page"/></c:when>
						<c:otherwise><c:set value="" var="flag" scope="page"/></c:otherwise>
					</c:choose>
					<tr align="center">
						<td align="center">
							<input type="radio" class="radiobutton" name="selcredit" >
						</td>
						<td align="center">
							<span name="credit/list[${flag}${index}]@seq_no" ><x:out select="$list/@seq_no"/></span> 
						</td>
						<td align="center">
							<input type="text" name="credit/list[${flag}${index}]/bank"  label="贷款银行" style="width:80%"   class=" input_text required" value="<x:out select="$list/bank" />" maxlength="50"/>
						</td>
						<td align="center">
							<c:set var="purchase2_value"><x:out select="$list/purchase2_value" /></c:set>
							<cpt:select id="apurchase_auto${index}" key="credit" name="purchase2"  value="${purchase2_value }" onChange="initControlValue(this.id);countjsTable9('tblDetailed');" style="width:80%"></cpt:select>
					            <input type="hidden" name="credit/list[${flag}${index}]/purchase2_value" class="required" label="贷款类别" value="<x:out select="$list/purchase2_value" />"/>
					            <input type="hidden" name="credit/list[${flag}${index}]/purchase2_name" value="<x:out select="$list/purchase2_name" />"/>
						</td> 
						
						<td align="center">
							<input type="text" name="credit/list[${flag}${index}]/money" onchange="countjsTable9('tblcredit');" label="贷款金额"  onfocus="InitInput.setNumber(this,9,2,2)"   style="text-align:right;width:80%"  class=" input_text required" value="<x:out select="$list/money" />"/>
						</td> 
					
						<td align="center">
							<input type="text" name="credit/list[${flag}${index}]/contract"  label="贷款合同编号" style="width:80%"   class=" input_text required" value="<x:out select="$list/contract" />" maxlength="50"/>
						</td>
						
						<td align="center" nowrap>
							<input type="text" name="credit/list[${flag}${index}]/loan_term" label="贷款期限"  onfocus="InitInput.setNumber(this,9,0,0)"   style="text-align:right;width:80%"  class=" input_text required" value="<x:out select="$list/loan_term" />"  />
						</td>
						
						<td align="center">
							<input type="text" name="credit/list[${flag}${index}]/interest_rate" label="贷款利率"  onfocus="InitInput.setNumber(this,9,2,2)"   style="text-align:right;width:80%"  class=" input_text required" value="<x:out select="$list/interest_rate" />"/>
						</td> 
						<td align="center">
							<input type="text" id="list[${flag}${index}]_interest_total" name="credit/list[${flag}${index}]/interest_total" onchange="countjsTable9('tblDetailed');" label="利息总额"  onfocus="InitInput.setNumber(this,9,2,2)"   style="text-align:right;width:80%"  class=" input_text required valueGreatEqual:list[${flag}${index}]_interest_total:list[${flag}${index}]_interest_already" value="<x:out select="$list/interest_total" />"/>
						</td> 
						<td align="center">
							<input type="text" id="list[${flag}${index}]_interest_already" name="credit/list[${flag}${index}]/interest_already" onchange="countjsTable9('tblDetailed');" label="已付利息"  onfocus="InitInput.setNumber(this,9,2,2)"   style="text-align:right;width:80%"  class=" input_text required" value="<x:out select="$list/interest_already" />"/>
						</td> 
						
					
					</tr>
					<c:set value="${index+1}" var="index" scope="page"/>
					</x:forEach>
					<script type="text/javascript">
						showAllDateTag("tblDetailed");
					</script>
				</tbody>
			</table>
			<table   cellpadding="0" class="table01 t_css" width="100%" border="0" cellpadding="0" style="*border-bottom: #a1c0dc 1px solid;" id="budgetsMsg4">
					
					<tr align="center">
						<td width="34%">一般商业贷款小计</td>
						<td width="10%"><input name="credit_list/money1" id="credit_list_money_1" value="<x:out select="$xmlData/data/credit_list/money1" />" class="gray input_text valueGreatEqual:credit_list_money_1:general_1" label="一般商业贷款小计"  style="text-align:right;width:80%" disabled  onfocus="InitInput.setNumber(this,9,2,2)" /></td>
						<td width="13%">/</td>
						<td width="13%">/</td>
						<td width="10%">/</td>
						<td width="10%"><input name="credit_list/money2" id="credit_list_money_2" value="<x:out select="$xmlData/data/credit_list/money2" />" class="gray input_text"  style="text-align:right;width:80%" disabled  onfocus="InitInput.setNumber(this,9,2,2)" /></td>
						<td width="10%"><input name="credit_list/money3" id="credit_list_money_3" value="<x:out select="$xmlData/data/credit_list/money3" />" class="gray input_text"  style="text-align:right;width:80%" disabled  onfocus="InitInput.setNumber(this,9,2,2)" /></td>
		
					</tr> 
					<tr align="center">
						<td>风险补偿贷款小计</td>
						<td><input name="credit_list/money4" id="credit_list_money_4" value="<x:out select="$xmlData/data/credit_list/money4" />" class="gray input_text valueGreatEqual:credit_list_money_4:risk_1" label="一般商业贷款小计"   style="text-align:right;width:80%" disabled  onfocus="InitInput.setNumber(this,9,2,2)" /></td>
						<td>/</td>
						<td>/</td>
						<td>/</td>
						<td><input name="credit_list/money5" id="credit_list_money_5" value="<x:out select="$xmlData/data/credit_list/money5" />" class="gray input_text"  style="text-align:right;width:80%" disabled  onfocus="InitInput.setNumber(this,9,2,2)" /></td>
						<td><input name="credit_list/money6" id="credit_list_money_6" value="<x:out select="$xmlData/data/credit_list/money6" />" class="gray input_text"  style="text-align:right;width:80%" disabled  onfocus="InitInput.setNumber(this,9,2,2)" /></td>
					</tr>
					<tr align="center">
						<td>专利质押贷款小计</td>
						<td><input name="credit_list/money7" id="credit_list_money_7" value="<x:out select="$xmlData/data/credit_list/money7" />" class="gray input_text valueGreatEqual:credit_list_money_4:patent_1"  style="text-align:right;width:80%" disabled  onfocus="InitInput.setNumber(this,9,2,2)" /></td>
						<td>/</td>
						<td>/</td>
						<td>/</td>
						<td><input name="credit_list/money8" id="credit_list_money_8" value="<x:out select="$xmlData/data/credit_list/money8" />" class="gray input_text"  style="text-align:right;width:80%" disabled  onfocus="InitInput.setNumber(this,9,2,2)" /></td>
						<td><input name="credit_list/money9" id="credit_list_money_9" value="<x:out select="$xmlData/data/credit_list/money9" />" class="gray input_text"  style="text-align:right;width:80%" disabled  onfocus="InitInput.setNumber(this,9,2,2)" /></td>
					</tr>
				
					<tr align="center">
						<td>合     计</td>
						<td><input name="credit_list/money10" id="credit_list_money_10" value="<x:out select="$xmlData/data/credit_list/money10" />" class="gray input_text"  style="text-align:right;width:80%" disabled  onfocus="InitInput.setNumber(this,9,2,2)" /></td>
						<td>/</td>
						<td>/</td>
						<td>/</td>
						<td><input name="credit_list/money11" id="credit_list_money_11" value="<x:out select="$xmlData/data/credit_list/money11" />" class="gray input_text"  style="text-align:right;width:80%" disabled  onfocus="InitInput.setNumber(this,9,2,2)" /></td>
						<td><input name="credit_list/money12" id="credit_list_money_12" value="<x:out select="$xmlData/data/credit_list/money12" />" class="gray input_text"  style="text-align:right;width:80%" disabled  onfocus="InitInput.setNumber(this,9,2,2)" /></td>
					</tr>
					</table>
					
					<table width="98%" align="center" border="0">
					<tr style="border: 0"><td style="border: 0">
					<input class="button" name="cmdAddbefore" type=button value="添加" onclick="if(checkTabLimit('tblDetailed',99,'${param.strDel}最多只能添加99条')){addNewRow('tblDetailed');showDateTag('tblDetailed');try{top.resizeFrame();}catch(e){};}">
					<input class="button" name="cmdMovePrev" type=button value="上移" onclick="movePrev('tblcredit','selcredit')">
					<input class="button" name="cmdMoveNext" type=button value="下移" onclick="moveNext('tblcredit','selcredit')">
					<input class="button" name="cmddel" type=button  value="删除" onclick="deleteSelectedRow('tblDetailed','${param.strDel}');countjsTable9('tblDetailed');">
					</td></tr>
	</table>	
		&nbsp;&nbsp;&nbsp;&nbsp;${param.beizhu}
	
	
<script type="text/javascript">

	function countjsTable9(tblId){
		 	var count1=0;
			var count2=0;
		   var count3=0;
		
		   var count4=0;
		   var count5=0;
		   var count6=0;
		   
		   var count7=0;
		   var count8=0;
		   var count9=0;
		   
		   var count10=0;
		   var count11=0;
		   var count12=0;
	
		   $("#tblDetailed tr:gt(1)").each(function() {
			   
			   var fund = $(this).children().eq("3").children().val();   //贷款类别
			   
			   var fund1 = $(this).children().eq("4").children().val();   //贷款金额
			   var fund2 = $(this).children().eq("8").children().val();   //利息总额
			   var fund3 = $(this).children().eq("9").children().val();   //已付利息

			   if (!$.isNumeric(fund)) fund = "0";
			   if (!$.isNumeric(fund1)) fund1 = "0.00";
			   if (!$.isNumeric(fund2)) fund2 = "0.00";
			   if (!$.isNumeric(fund3)) fund3 = "0.00";
		
				count10=accAdd(parseFloat(fund1),parseFloat(count10));   //合计相加
				count11=accAdd(parseFloat(fund2),parseFloat(count11));   //合计相加
				count12=accAdd(parseFloat(fund3),parseFloat(count12)); 
			  	
			  
				if(fund==1){    //一般商业贷款小计
					count1=accAdd(parseFloat(fund1),parseFloat(count1));   //一般商业贷款小计
					count2=accAdd(parseFloat(fund2),parseFloat(count2));   
					count3=accAdd(parseFloat(fund3),parseFloat(count3)); 
				}
				
				if(fund==2){
					count4=accAdd(parseFloat(fund1),parseFloat(count4));   //风险补偿贷款小计
					count5=accAdd(parseFloat(fund2),parseFloat(count5));   
					count6=accAdd(parseFloat(fund3),parseFloat(count6)); 
				}
				   
				if(fund==3){
					count7=accAdd(parseFloat(fund1),parseFloat(count7));   //风险补偿贷款小计
					count8=accAdd(parseFloat(fund2),parseFloat(count8));   
					count9=accAdd(parseFloat(fund3),parseFloat(count9)); 
				}
			
			
			   
				
	    });
		   
		  
		   count1 = formatNumberAutoOther(count1.toString(), 9, 2, 2);// 格式化金额
	      count2 = formatNumberAutoOther(count2.toString(), 9, 2, 2);// 格式化金额
		   count3 = formatNumberAutoOther(count3.toString(), 9, 2, 2);// 格式化金额
		   count4 = formatNumberAutoOther(count4.toString(), 9, 2, 2);// 格式化金额
		   count5 = formatNumberAutoOther(count5.toString(), 9, 2, 2);// 格式化金额
		   count6 = formatNumberAutoOther(count6.toString(), 9, 2, 2);// 格式化金额
		   count7 = formatNumberAutoOther(count7.toString(), 9, 2, 2);// 格式化金额
		   count8 = formatNumberAutoOther(count8.toString(), 9, 2, 2);// 格式化金额
		   count9 = formatNumberAutoOther(count9.toString(), 9, 2, 2);// 格式化金额
		   count10 = formatNumberAutoOther(count10.toString(), 9, 2, 2);// 格式化金额
		   count11 = formatNumberAutoOther(count11.toString(), 9, 2, 2);// 格式化金额
	      count12 = formatNumberAutoOther(count12.toString(), 9, 2, 2);// 格式化金额

		   
	    	  $("#credit_list_money_1").val(count1); 
	 		  $("#credit_list_money_2").val(count2); 
	 		  $("#credit_list_money_3").val(count3);
	 		  $("#credit_list_money_4").val(count4);  
	 		  $("#credit_list_money_5").val(count5);
			  $("#credit_list_money_6").val(count6);  
			  $("#credit_list_money_7").val(count7);
	 		  $("#credit_list_money_8").val(count8);  
	 		  $("#credit_list_money_9").val(count9);
			  $("#credit_list_money_10").val(count10);  
			  $("#credit_list_money_11").val(count11); 
	 		  $("#credit_list_money_12").val(count12); 
	 		
			  $("#load_total").val(count10);
			  $("#interests_unpay").val(count11);
			  $("#interests_payed").val(count12);
	   
	      
	}

			

	$(function (){
		//setTimeout("countjsTable9()","1500");	
	});		
			

	//初始化金额为0.0
	$(document).ready(function() {
		var prp_version=$("#prp_version").text();
		if(prp_version==""||prp_version==null){
			$("#budgetsMsg4").find(":input").each(function(){
				$(this).val("0.00");	
			});
		}
		
	});

</script>

